package com.miaomiao.domain.system;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;


@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserRoleIds {
    private Long userId;

    private String userName;

    private String password;

    private String realName;

    private String email;

    private String telephone;

    private String stuId;

    private List<Long> roleIds;

    public User getUser(){
        return new User(userId,userName,password,realName,email,telephone,stuId);
    }

    public List<UserRole> getUserRoles(){
        List<UserRole> userRoles = new ArrayList<>();
        for (Long roleId : roleIds) {
            UserRole userRole = new UserRole(userId,roleId);
            userRoles.add(userRole);
        }
        return userRoles;
    }

}
